#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

struct s
{
	char name[50];
	int age;
};

void com_name(const void* e1, const void* e2)
{
	return strcmp(((struct s*)e1)->name, ((struct s*)e2)->name);
}

int main()
{
	struct s arr[] = { {18, "wangwu"}, {20, "lisi"}, {6, "xiaotudou"}};
	int sz = sizeof(arr) / sizeof(arr[0]);
	qsort(arr, sz, sizeof(arr[0]), com_name);
	int i = 0;
	for (i = 0; i < sz; i++)
	{
		printf("%s\n", arr[i]);
	}
	return 0;
}